xl: correct calls to dolog() (aka LOG)
authorIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 8 Sep 2010 15:35:40 +0000 (16:35 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 8 Sep 2010 15:35:40 +0000 (16:35 +0100)
dolog, for which LOG is a macro wrapper, was lacking the printf format
attribute.  Add it, and fix the two problems revealed.

(Original patch for one of the occurrences from Ian Campbell.)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/xl_cmdimpl.c

index c2bfa0d311cfa4cd921f3dd267d09a915c51546c..c042426228f631bd2bd0bb45d6f4bbf4b48d1710 100644 (file)
@@ -236,6 +236,9 @@ static void find_domain(const char *p)
 
 #define LOG(_f, _a...)   dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a)
 
+static void dolog(const char *file, int line, const char *func, char *fmt, ...)
+     __attribute__((format(printf,4,5)));
+
 static void dolog(const char *file, int line, const char *func, char *fmt, ...)
 {
     va_list ap;
@@ -1123,7 +1126,7 @@ static int handle_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_event *even
         action = d_config->on_watchdog;
         break;
     default:
-        LOG("Unknown shutdown reason code %s. Destroying domain.", info->shutdown_reason);
+        LOG("Unknown shutdown reason code %d. Destroying domain.", info->shutdown_reason);
         action = ACTION_DESTROY;
     }
 
@@ -1537,7 +1540,7 @@ start:
         }
         rc = libxl_create_logfile(&ctx, name, &fullname);
         if (rc) {
-            LOG("failed to open logfile %s",fullname,strerror(errno));
+            LOG("failed to open logfile %s: %s",fullname,strerror(errno));
             exit(-1);
         }